package com.imooc.op_data

import scala.io.Source

object FileApp extends App {

  val file = Source.fromFile("/home/lynn/桌面/scala/scala_note.txt")(scala.io.Codec.UTF8)

  def readLine(): Unit ={
    for(line <- file.getLines()){
      println(line)
    }
  }

  readLine

  def readChar(): Unit ={
    for(ele <- file){
      println(ele)
    }
  }

  readChar

  def readNet(): Unit ={
    val file = Source.fromURL("https://www.baidu.com")
    for(line <- file.getLines()){
      println(line)
    }
  }

  readNet

}
